<html>
<head><meta charset="utf-8"><title>mismatched types diag #54326 · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html">mismatched types diag #54326</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165052299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165052299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165052299">(May 07 2019 at 08:28)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> continuing our conversation from yesterday on Discord, after <a href="https://github.com/rust-lang/rust/issues/60592" target="_blank" title="https://github.com/rust-lang/rust/issues/60592">#60592</a>, you mentioned needing to fix this case:</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Out</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">FooFromFn</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="p">(</span><span class="n">F</span><span class="p">);</span><span class="w"></span>
<span class="k">impl</span><span class="o">&lt;</span><span class="n">F</span>: <span class="nb">Fn</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">R</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">FooFromFn</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Out</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">R</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">Out</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">FooFromFn</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>Would you be able to elaborate a little on where you think the problem is so that I can start working on a fix later today?</p>



<a name="165073905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165073905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165073905">(May 07 2019 at 14:10)</a>:</h4>
<p>so the problem is you have these facts:</p>
<ul>
<li><code>$0: Foo&lt;Out = i32&gt;</code>, because of the <code>impl Foo</code></li>
<li>the <code>FooFromFn(...)</code> expr has the expected type <code>$0</code>, which won't be unified with <code>FooFromFn&lt;$1&gt;</code> until <em>after</em> the closure is checked</li>
<li>the closure has the expected type <code>$1</code> </li>
</ul>
<p>there is no <code>$1: Fn() -&gt; i32</code> bound, only <code>$0: Foo&lt;Out = i32&gt;</code> and <em>effectively</em> <code>FooFromFn&lt;$1&gt; coerces to $0</code> which isn't stored down anywhere today (but we probably could?)</p>



<a name="165074049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165074049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165074049">(May 07 2019 at 14:12)</a>:</h4>
<p>also, the <code>$1: Fn() -&gt; i32</code> bound would potentially be wrong to have as a known fact, unless we short-circuit the coercion and unify <code>$0</code> with <code>FooFromFn&lt;$1&gt;</code>, so that we can elaborate the predicates and get <code>$1: Fn() -&gt; i32</code> "for free"</p>



<a name="165074056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165074056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165074056">(May 07 2019 at 14:12)</a>:</h4>
<p>let me rephrase, ugh</p>



<a name="165074664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165074664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165074664">(May 07 2019 at 14:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> <em>however</em>, that short-circuit is dangerous, because...</p>



<a name="165074747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165074747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165074747">(May 07 2019 at 14:18)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="n">FooFromFn</span><span class="p">({</span><span class="w"></span>
<span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="p">(</span><span class="n">expr</span>: <span class="nc">SomeOtherType</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="o">||</span><span class="w"> </span><span class="kc">true</span><span class="w"></span>
<span class="p">})</span><span class="w"></span>
</pre></div>



<a name="165075017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165075017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165075017">(May 07 2019 at 14:20)</a>:</h4>
<p>that will cause <code>$0</code> to be unified with <code>SomeOtherType</code> <em>before</em> <code>FooFromFn&lt;$1&gt;</code> is attempted to be coerced to <code>SomeOtherType</code></p>



<a name="165075071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165075071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165075071">(May 07 2019 at 14:21)</a>:</h4>
<p>so we could only do this in the very special case of "there is only one truth source for this inference variable, and it's the type of this expression"</p>



<a name="165075120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165075120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165075120">(May 07 2019 at 14:21)</a>:</h4>
<p>in which case, it can be unified early with the "expected type skeleton" or w/e</p>



<a name="165075226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165075226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165075226">(May 07 2019 at 14:22)</a>:</h4>
<p>this is all very disturbing tbh, I'd get a hold of <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  first</p>



<a name="165599080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/165599080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#165599080">(May 14 2019 at 07:15)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you have any thoughts on the above?</p>



<a name="166742657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/166742657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#166742657">(May 28 2019 at 17:59)</a>:</h4>
<p>(apologies for yet another ping, but in case this got missed in what I assume is a sea of notifications, <span class="user-mention" data-user-id="116009">@nikomatsakis</span>)</p>



<a name="166742906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/166742906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#166742906">(May 28 2019 at 18:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> =) you're not wrong</p>



<a name="168068595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168068595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168068595">(Jun 13 2019 at 17:53)</a>:</h4>
<p>ok so to jump back to this for a <em>few minutes</em></p>



<a name="168068728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168068728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168068728">(Jun 13 2019 at 17:54)</a>:</h4>
<p>I'm trying to catch up with eddyb here</p>



<a name="168068827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168068827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168068827">(Jun 13 2019 at 17:55)</a>:</h4>
<p>it's definitely true that we'd <em>prefer</em> not to solve this in the desugaring</p>



<a name="168068897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168068897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168068897">(Jun 13 2019 at 17:56)</a>:</h4>
<p>how much do you get the context here, <span class="user-mention" data-user-id="116107">@davidtwco</span> ?</p>



<a name="168068914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168068914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168068914">(Jun 13 2019 at 17:56)</a>:</h4>
<p>Very little, unfortunately.</p>



<a name="168069123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069123">(Jun 13 2019 at 17:58)</a>:</h4>
<p>you know about the idea of an expected type?</p>



<a name="168069139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069139">(Jun 13 2019 at 17:58)</a>:</h4>
<p>A little bit.</p>



<a name="168069172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069172">(Jun 13 2019 at 17:59)</a>:</h4>
<p>ok so if you have <code>let x: u32 = ...</code></p>



<a name="168069185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069185">(Jun 13 2019 at 17:59)</a>:</h4>
<p>then when we are typing the <code>...</code> we know it's supposed to produce a <code>u32</code></p>



<a name="168069238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069238">(Jun 13 2019 at 17:59)</a>:</h4>
<p>we sometimes go to some lengths here</p>



<a name="168069247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069247">(Jun 13 2019 at 17:59)</a>:</h4>
<p>And the same is true with function return types from signatures, for example?</p>



<a name="168069323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069323">(Jun 13 2019 at 18:00)</a>:</h4>
<p>(that it would be used as a expected type)</p>



<a name="168069326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069326">(Jun 13 2019 at 18:00)</a>:</h4>
<p>so...</p>



<a name="168069330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069330">(Jun 13 2019 at 18:00)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(async_await, futures_api)]</span><span class="w"></span>

<span class="n">async</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="mi">5</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168069339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069339">(Jun 13 2019 at 18:00)</a>:</h4>
<p>can we desugar this a bit?</p>



<a name="168069348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069348">(Jun 13 2019 at 18:00)</a>:</h4>
<p>how bad is the desugared version? :)</p>



<a name="168069353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069353">(Jun 13 2019 at 18:00)</a>:</h4>
<p>but yeah the problem here is that, somehow,</p>



<a name="168069360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069360">(Jun 13 2019 at 18:00)</a>:</h4>
<p>the return type of the future</p>



<a name="168069367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069367">(Jun 13 2019 at 18:00)</a>:</h4>
<p>is being left to be inferred</p>



<a name="168069376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069376">(Jun 13 2019 at 18:00)</a>:</h4>
<p>and only later (too late) unified with <code>i32</code></p>



<a name="168069388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069388">(Jun 13 2019 at 18:00)</a>:</h4>
<p>this is why the diagnostics are confusing</p>



<a name="168069420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069420">(Jun 13 2019 at 18:01)</a>:</h4>
<p>we have some similar logic, e.g., for clsoures if you do:</p>



<a name="168069429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069429">(Jun 13 2019 at 18:01)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="kt">i32</span><span class="p">))</span><span class="w"></span>
</pre></div>



<a name="168069439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069439">(Jun 13 2019 at 18:01)</a>:</h4>
<p>you could imagine us saying "the closure returns a type <code>?T</code>"</p>



<a name="168069442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069442">(Jun 13 2019 at 18:01)</a>:</h4>
<p>and checking the body</p>



<a name="168069453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069453">(Jun 13 2019 at 18:01)</a>:</h4>
<p>and then comparing the <code>?T</code> against the type in the signature of <code>foo</code></p>



<a name="168069456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069456">(Jun 13 2019 at 18:01)</a>:</h4>
<p>and you would get a similar error</p>



<a name="168069478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069478">(Jun 13 2019 at 18:01)</a>:</h4>
<p>but what we actually do is to look at the signature of <code>foo</code> and try to see if we can figure out what the closure is <em>supposed</em> to return</p>



<a name="168069490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069490">(Jun 13 2019 at 18:02)</a>:</h4>
<p>so we can "bias" the error that way</p>



<a name="168069535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069535">(Jun 13 2019 at 18:02)</a>:</h4>
<p>(this also helps with coercions)</p>



<a name="168069557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069557">(Jun 13 2019 at 18:02)</a>:</h4>
<p>this is a bit subtle for closures because, if you look at <code>foo</code>, it often looks like</p>



<a name="168069569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069569">(Jun 13 2019 at 18:02)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Fn</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span><span class="o">&gt;</span><span class="p">(</span><span class="n">t</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168069589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069589">(Jun 13 2019 at 18:02)</a>:</h4>
<p>so when we type-check <code>foo(|| Ok(22))</code></p>



<a name="168069611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069611">(Jun 13 2019 at 18:02)</a>:</h4>
<p>what happens is that we replace <code>T</code> (here, the closure type) with a fresh variable, let's call it <code>?C</code></p>



<a name="168069627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069627">(Jun 13 2019 at 18:03)</a>:</h4>
<p>and then we have this "trait obligation" <code>?C: Fn() -&gt; i32</code></p>



<a name="168069649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069649">(Jun 13 2019 at 18:03)</a>:</h4>
<p>which can't be proven yet because we don't know what <code>?C</code> <em>is</em></p>



<a name="168069668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069668">(Jun 13 2019 at 18:03)</a>:</h4>
<p>to infer the closure return type, therefore, the code that <span class="user-mention" data-user-id="119009">@eddyb</span> pointed us out goes and looks through the list of pending things we have to prove in the future</p>



<a name="168069676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069676">(Jun 13 2019 at 18:03)</a>:</h4>
<p>and looks for something like that</p>



<a name="168069682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069682">(Jun 13 2019 at 18:03)</a>:</h4>
<p>to extract the return type</p>



<a name="168069695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069695">(Jun 13 2019 at 18:03)</a>:</h4>
<p>the scenario here is going to be similar-ish</p>



<a name="168069715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069715">(Jun 13 2019 at 18:04)</a>:</h4>
<p>the <code>async { .. .}</code> at the heart of the desugaring, afer all, is generating a future type <code>?F</code></p>



<a name="168069760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069760">(Jun 13 2019 at 18:04)</a>:</h4>
<p>which must implement <code>?F: Future&lt;Output = i32&gt;</code></p>



<a name="168069778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069778">(Jun 13 2019 at 18:04)</a>:</h4>
<p>so to figure out the expected type we have to match that expectation</p>



<a name="168069796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069796">(Jun 13 2019 at 18:04)</a>:</h4>
<p>from <span class="user-mention" data-user-id="119009">@eddyb</span>'s comments above, it sounds like that might be a bit tricky though</p>



<a name="168069808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069808">(Jun 13 2019 at 18:04)</a>:</h4>
<p>but I think we gotta run to meta mtg :)</p>



<a name="168069824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069824">(Jun 13 2019 at 18:04)</a>:</h4>
<p>Ah yeah, it's just us today, I think.</p>



<a name="168069847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069847">(Jun 13 2019 at 18:05)</a>:</h4>
<p>(out of Santiago, you and I at least)</p>



<a name="168069849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069849">(Jun 13 2019 at 18:05)</a>:</h4>
<p>oh right</p>



<a name="168069858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168069858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168069858">(Jun 13 2019 at 18:05)</a>:</h4>
<p>well let's just do a quick scan at least ;)</p>



<a name="168070796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168070796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168070796">(Jun 13 2019 at 18:15)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="116107">@davidtwco</span> so... I wanted to get a more accurate desugaring here</p>



<a name="168070802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168070802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168070802">(Jun 13 2019 at 18:15)</a>:</h4>
<p>because the details matter</p>



<a name="168070930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168070930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168070930">(Jun 13 2019 at 18:17)</a>:</h4>
<p>is there an easy way to do that?</p>



<a name="168070989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168070989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168070989">(Jun 13 2019 at 18:17)</a>:</h4>
<p>I guess that</p>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(async_await, futures_api)]</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">future</span>::<span class="n">Future</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Future</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">async</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">return</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>

<span class="w">        </span><span class="mi">5</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168070995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168070995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168070995">(Jun 13 2019 at 18:17)</a>:</h4>
<p>produces the same error, so that's something</p>



<a name="168071006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071006">(Jun 13 2019 at 18:17)</a>:</h4>
<p>I can dump the HIR locally if that would help.</p>



<a name="168071090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071090">(Jun 13 2019 at 18:18)</a>:</h4>
<p>I'm trying to remember all the flags for this sort of thing</p>



<a name="168071127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071127">(Jun 13 2019 at 18:18)</a>:</h4>
<p>I guess <code>-Zunpretty=hir-tree</code></p>



<a name="168071168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071168">(Jun 13 2019 at 18:19)</a>:</h4>
<p>or just <code>-Zunpretty=hir</code></p>



<a name="168071177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071177">(Jun 13 2019 at 18:19)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"></span>
<span class="w"> </span>-&gt;
      <span class="p">{</span><span class="w"></span>
<span class="w">          </span>::<span class="n">std</span>::<span class="n">future</span>::<span class="n">from_generator</span><span class="p">(</span><span class="w"></span>

<span class="w">                                        </span><span class="o">||</span><span class="w"></span>
<span class="w">                                            </span><span class="p">{</span><span class="w"></span>
<span class="w">                                                </span><span class="k">match</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">_t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"> </span><span class="n">_t</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                                    </span><span class="kc">true</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                </span><span class="mi">5</span><span class="w"></span>
<span class="w">                                            </span><span class="p">})</span><span class="w"></span>
<span class="w">      </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168071198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071198">(Jun 13 2019 at 18:19)</a>:</h4>
<p><a href="https://gist.github.com/davidtwco/64093538b6892bf6afe1143ac07e1d2c" target="_blank" title="https://gist.github.com/davidtwco/64093538b6892bf6afe1143ac07e1d2c">This is the <code>hir-tree</code></a>.</p>



<a name="168071280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071280">(Jun 13 2019 at 18:20)</a>:</h4>
<p>what's up with <code>_t = false</code> business?</p>



<a name="168071281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071281">(Jun 13 2019 at 18:20)</a>:</h4>
<p>oh</p>



<a name="168071288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071288">(Jun 13 2019 at 18:20)</a>:</h4>
<p>that's the desugaring for <code>if</code> I guess</p>



<a name="168071290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071290">(Jun 13 2019 at 18:20)</a>:</h4>
<p>dear god</p>



<a name="168071294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071294">(Jun 13 2019 at 18:20)</a>:</h4>
<p>:)</p>



<a name="168071300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071300">(Jun 13 2019 at 18:20)</a>:</h4>
<p>beautiful</p>



<a name="168071304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071304">(Jun 13 2019 at 18:20)</a>:</h4>
<p>and terrible</p>



<a name="168071307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071307">(Jun 13 2019 at 18:20)</a>:</h4>
<p>all at once</p>



<a name="168071368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071368">(Jun 13 2019 at 18:21)</a>:</h4>
<p>ok so <code>from_generator</code> is</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">from_generator</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Generator</span><span class="o">&lt;</span><span class="n">Yield</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Future</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span>::<span class="n">Return</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">GenFuture</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168071393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071393">(Jun 13 2019 at 18:21)</a>:</h4>
<p>so this is pretty complex</p>



<a name="168071431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071431">(Jun 13 2019 at 18:22)</a>:</h4>
<p>the link between the <em>actual</em> return value and the expectation is rather...removed</p>



<a name="168071490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071490">(Jun 13 2019 at 18:22)</a>:</h4>
<p>i.e., the function is returning an opaque type</p>



<a name="168071502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071502">(Jun 13 2019 at 18:22)</a>:</h4>
<p>let's call it <code>?0</code></p>



<a name="168071512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071512">(Jun 13 2019 at 18:22)</a>:</h4>
<p>which has to meet the requirement <code>?0: Future&lt;Output = i32&gt;</code></p>



<a name="168071561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071561">(Jun 13 2019 at 18:23)</a>:</h4>
<p>and then there is a call to <code>from_generator</code> which returns an opaque type <code>impl Future&lt;Output = T::Return&gt;</code></p>



<a name="168071591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071591">(Jun 13 2019 at 18:23)</a>:</h4>
<p>so the expected type for the generator is <code>?1</code> (instantiated value of <code>T</code>)</p>



<a name="168071596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071596">(Jun 13 2019 at 18:23)</a>:</h4>
<p>and we have the obligations that</p>



<a name="168071735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071735">(Jun 13 2019 at 18:24)</a>:</h4>
<div class="codehilite"><pre><span></span>?1: Generator&lt;Yield = ()&gt;
&lt;?0 as Future&gt;::Output = &lt;?1 as Generator&gt;::Return
</pre></div>


<p>or..something like that...</p>



<a name="168071751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071751">(Jun 13 2019 at 18:24)</a>:</h4>
<p>I should probably just dump state of compiler to see I guess</p>



<a name="168071758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071758">(Jun 13 2019 at 18:25)</a>:</h4>
<blockquote>
<p>that's the desugaring for if I guess</p>
</blockquote>
<p>(It is lying a little bit; there's no actual let binding there but <code>ExprKind::DropTemps(false)</code>; but the block is the semantic equivalent)</p>



<a name="168071918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071918">(Jun 13 2019 at 18:26)</a>:</h4>
<p>so I'm going to run with</p>
<div class="codehilite"><pre><span></span>&gt; <span class="nv">RUSTC_LOG</span><span class="o">=</span>rustc_typeck::check::closure  rustc +rust-2-stage2 ~/tmp/issue-54326.rs --edition <span class="m">2018</span>
</pre></div>



<a name="168071965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168071965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168071965">(Jun 13 2019 at 18:26)</a>:</h4>
<p>and we get</p>
<div class="codehilite"><pre><span></span>DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: check_expr_closure(expr=expr(HirId { owner: DefIndex(13), local_id: 23 }: ||),expected=ExpectHasType(_#1t))
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_expectations_from_expected_type(expected_ty=_#1t)
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(TraitPredicate(&lt;_#1t as std::marker::Sized&gt;))
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(TraitPredicate(&lt;_#1t as std::ops::Generator&gt;))
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ cor\
e[53a4]::ops[0]::generator[0]::Generator[0]::Yield[0]) }, ()))
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_sig_from_projection(Binder(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ core[53a4]::ops[0]::generator[0]::G\
enerator[0]::Yield[0]) }, ())))
DEBUG 2019-06-13T18:26:19Z: rustc_typeck::check::closure: deduce_sig_from_projection: not return assoc item of generator
</pre></div>



<a name="168072063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072063">(Jun 13 2019 at 18:27)</a>:</h4>
<p>interestingly</p>



<a name="168072073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072073">(Jun 13 2019 at 18:27)</a>:</h4>
<p>we don't know the return type information yet</p>



<a name="168072085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072085">(Jun 13 2019 at 18:27)</a>:</h4>
<p>which I think <span class="user-mention" data-user-id="119009">@eddyb</span> was alluding to above :)</p>



<a name="168072166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072166">(Jun 13 2019 at 18:28)</a>:</h4>
<p>we have three pending things:</p>
<div class="codehilite"><pre><span></span>?1: Sized
?1: Generator
&lt;?1 as Generator&gt;::Yield = ()
</pre></div>



<a name="168072194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072194">(Jun 13 2019 at 18:28)</a>:</h4>
<p>the last one is a bit uglier in Rust's debug output :)</p>
<div class="codehilite"><pre><span></span>(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ core[53a4]::ops[0]::generator[0]::Generator[0]::Yield[0]) }, ())
</pre></div>



<a name="168072212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072212">(Jun 13 2019 at 18:28)</a>:</h4>
<p>a "projection predicate" is refers to proving the value of an associated type is equal to something else</p>



<a name="168072228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072228">(Jun 13 2019 at 18:29)</a>:</h4>
<p>the core::ops::generator::Generator::Yield identifies the associated type (and its trait)</p>



<a name="168072249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072249">(Jun 13 2019 at 18:29)</a>:</h4>
<p>and the substitutions are the type parameters from the trait (and, once we have GATs, the associated type)</p>



<a name="168072259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072259">(Jun 13 2019 at 18:29)</a>:</h4>
<p>in this case, <code>[1]</code></p>



<a name="168072283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072283">(Jun 13 2019 at 18:29)</a>:</h4>
<p>so the point is that, with the setup we have now, we just don't know anything about this <code>i32</code></p>



<a name="168072288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072288">(Jun 13 2019 at 18:29)</a>:</h4>
<p>that presumably comes later</p>



<a name="168072397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072397">(Jun 13 2019 at 18:30)</a>:</h4>
<p>but I gotta run now and do some other triage</p>



<a name="168072411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072411">(Jun 13 2019 at 18:30)</a>:</h4>
<p>lang team pre mtg:)</p>



<a name="168072458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072458">(Jun 13 2019 at 18:31)</a>:</h4>
<p>Thanks!</p>



<a name="168072466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072466">(Jun 13 2019 at 18:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  waiting for you there <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="168072792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168072792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168072792">(Jun 13 2019 at 18:35)</a>:</h4>
<blockquote>
<p>so the point is that, with the setup we have now, we just don't know anything about this <code>i32</code></p>
</blockquote>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> just realized this is prob wrong -- I think the debug output is just filtering out some of the obligations</p>



<a name="168076272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168076272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168076272">(Jun 13 2019 at 19:12)</a>:</h4>
<p>The extra logging in this snippet has all of the obligations (those with <code>deduce_expectations_from_obligations</code> lines too are the ones that are not filtered):</p>
<div class="codehilite"><pre><span></span>DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_expectations_from_expected_type(expected_ty=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: obligations_for_self_ty: self_ty=_#1t ty_var_root=_#1t pending_obligations=[/* omitted by davidtwco as they&#39;re listed below */]
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#0t as std::marker::Sized&gt;), self_ty=_#0t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#0t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#0t as std::future::Future&gt;), self_ty=_#0t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#0t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#0t as std::future::Future&gt;), self_ty=_#0t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#0t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#1t as std::marker::Sized&gt;), self_ty=_#1t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#1t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(TraitPredicate(&lt;_#1t as std::marker::Sized&gt;))
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#1t as std::ops::Generator&gt;), self_ty=_#1t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#1t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(TraitPredicate(&lt;_#1t as std::ops::Generator&gt;))
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid(trait_ref=Binder(&lt;_#1t as std::ops::Generator&gt;), self_ty=_#1t, expected_vid=_#1t)
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check: self_type_matches_expected_vid - found_vid=_#1t
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_expectations_from_obligations: obligation.predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ core[54d4]::ops
[0]::generator[0]::Generator[0]::Yield[0]) }, ()))
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_sig_from_projection(Binder(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ core[54d4]::ops[0]::generator[0]::Generator[0]:
:Yield[0]) }, ())))
DEBUG 2019-06-13T19:10:33Z: rustc_typeck::check::closure: deduce_sig_from_projection: not return assoc item of generator
</pre></div>



<a name="168513399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168513399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168513399">(Jun 19 2019 at 14:48)</a>:</h4>
<p>So there was talk of setting up a meeting here -- I could perhaps meet tomorrow at 8am or 9am UTC-07:00 (Pacific time)</p>



<a name="168513415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168513415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168513415">(Jun 19 2019 at 14:48)</a>:</h4>
<p>I'm here now, too, but I don't know if <span class="user-mention" data-user-id="127859">@Taylor Cramer</span> or <span class="user-mention" data-user-id="116107">@davidtwco</span> are..</p>



<a name="168514547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168514547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168514547">(Jun 19 2019 at 15:02)</a>:</h4>
<p>Oh, I'm here now</p>



<a name="168514556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168514556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168514556">(Jun 19 2019 at 15:02)</a>:</h4>
<p>I am</p>



<a name="168514587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168514587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168514587">(Jun 19 2019 at 15:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> still around?</p>



<a name="168514701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168514701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168514701">(Jun 19 2019 at 15:03)</a>:</h4>
<p>8 or 9 PST tomorrow would also work for me</p>



<a name="168514821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168514821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168514821">(Jun 19 2019 at 15:04)</a>:</h4>
<p>Likewise if it's just in Zulip and not Zoom.</p>



<a name="168515308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515308">(Jun 19 2019 at 15:08)</a>:</h4>
<p>I'm here</p>



<a name="168515317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515317">(Jun 19 2019 at 15:08)</a>:</h4>
<p>but it would have to be zulip, yeah</p>



<a name="168515413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515413">(Jun 19 2019 at 15:09)</a>:</h4>
<p>I guess the first question is how hard we want to work on this :</p>



<a name="168515523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515523">(Jun 19 2019 at 15:10)</a>:</h4>
<p>that said</p>



<a name="168515526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515526">(Jun 19 2019 at 15:10)</a>:</h4>
<p>hmm</p>



<a name="168515533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515533">(Jun 19 2019 at 15:10)</a>:</h4>
<p>there is a connection to some other diagnostic failures iirc</p>



<a name="168515546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515546">(Jun 19 2019 at 15:10)</a>:</h4>
<p>or just general inference failures I mean</p>



<a name="168515604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515604">(Jun 19 2019 at 15:11)</a>:</h4>
<p>notably there is some issue about <code>fn foo&lt;T: Foo&gt;(t: T)</code> where you have <code>impl Foo for Fn(u32)</code>. The problem is that, today, we can't infer the expected type when you do <code>foo(|x| ...)</code>, so we don't know the type of <code>x</code>.</p>



<a name="168515670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515670">(Jun 19 2019 at 15:12)</a>:</h4>
<p>this feels similar -- the problem there being that we have a pending obligation for <code>T: Foo</code>, but we don't (yet) know that this can only be solved by <code>T: Fn(u32)</code></p>



<a name="168515684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515684">(Jun 19 2019 at 15:12)</a>:</h4>
<p>it seems like in both cases we're kind of talking about "simplifying" the expectations</p>



<a name="168515698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515698">(Jun 19 2019 at 15:12)</a>:</h4>
<p>(sigh, this will make the chalk style solving strategy more complex too)</p>



<a name="168515722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515722">(Jun 19 2019 at 15:12)</a>:</h4>
<p>but I think the first thing would be to establish whether, indeed, we know enough to even theoretically figure things out</p>



<a name="168515761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515761">(Jun 19 2019 at 15:13)</a>:</h4>
<p>I'd personally be happy with something more narrow that could specifically propagate the required output type for async blocks, since iirc we have similar existing logic for closures</p>



<a name="168515800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515800">(Jun 19 2019 at 15:13)</a>:</h4>
<p>But if you think we can solve this in a more principled way, I'm happy to spend time on it</p>



<a name="168515816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515816">(Jun 19 2019 at 15:13)</a>:</h4>
<p>I would be ok with something narrow, but we hvae to figure out what it should be</p>



<a name="168515882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515882">(Jun 19 2019 at 15:14)</a>:</h4>
<p>the link for the return type etc is pretty separated</p>



<a name="168515890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515890">(Jun 19 2019 at 15:14)</a>:</h4>
<p>I'm re-reading the backscroll to try and page this back in a bit</p>



<a name="168515894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515894">(Jun 19 2019 at 15:14)</a>:</h4>
<p>I'm also happy to work on this, all I managed to accomplish when first looking at the issue was generalizing the closure special-casing to generators.</p>



<a name="168515929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515929">(Jun 19 2019 at 15:15)</a>:</h4>
<p>I mean the <em>easiest</em> thing would be to add some sort of special node in the HIR I guess</p>



<a name="168515966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515966">(Jun 19 2019 at 15:15)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"></span>
<span class="w"> </span>-&gt;
      <span class="p">{</span><span class="w"></span>
<span class="w">          </span>::<span class="n">std</span>::<span class="n">future</span>::<span class="n">from_generator</span><span class="p">(</span><span class="w"></span>

<span class="w">                                        </span><span class="o">||</span><span class="w"></span>
<span class="w">                                            </span><span class="p">{</span><span class="w"></span>
<span class="w">                                                </span><span class="k">match</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">_t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"> </span><span class="n">_t</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                                    </span><span class="kc">true</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                </span><span class="p">}</span><span class="w"></span>
<span class="w">                                                </span><span class="mi">5</span><span class="w"></span>
<span class="w">                                            </span><span class="p">})</span><span class="w"></span>
<span class="w">      </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168515970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168515970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168515970">(Jun 19 2019 at 15:15)</a>:</h4>
<p>that's the desugaring we posted before</p>



<a name="168516047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516047">(Jun 19 2019 at 15:16)</a>:</h4>
<p>the expected return type of the <code>from_generator</code> call is pretty separated from the requirements on the arguments</p>



<a name="168516055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516055">(Jun 19 2019 at 15:16)</a>:</h4>
<p>(this is the "link" I'm referring to)</p>



<a name="168516060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516060">(Jun 19 2019 at 15:16)</a>:</h4>
<p>Unfortunately, the bug that makes HIR lowering output for async fns means we can't see the return type from it.</p>



<a name="168516067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516067">(Jun 19 2019 at 15:16)</a>:</h4>
<p>yeah but that's ok</p>



<a name="168516069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516069">(Jun 19 2019 at 15:16)</a>:</h4>
<p>you know it's there ;)</p>



<a name="168516074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516074">(Jun 19 2019 at 15:16)</a>:</h4>
<p>some sort of <code>-&gt; impl Future</code>, I presume</p>



<a name="168516105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516105">(Jun 19 2019 at 15:17)</a>:</h4>
<p>anyway I could imagine that we desugar to something like</p>



<a name="168516137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516137">(Jun 19 2019 at 15:17)</a>:</h4>
<p><code>from_generator(|| -&gt; XX { .. })</code>, except we couldn't write the <code>XX</code> -- i.e., we don't really have the syntax for what you'd want there</p>



<a name="168516210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516210">(Jun 19 2019 at 15:18)</a>:</h4>
<p>or maybe we could do <code>from_generator::&lt;...XXX...&gt;</code> if we setup it up right, to let us specify the return type</p>



<a name="168516214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516214">(Jun 19 2019 at 15:18)</a>:</h4>
<p>Yeah, that was my initial attempt which failed because we don't have a way to copy types in hir</p>



<a name="168516228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516228">(Jun 19 2019 at 15:18)</a>:</h4>
<p>as <span class="user-mention" data-user-id="127859">@Taylor Cramer</span> mentioned somewhere, it'd be require duplicating info in the HIR if we did it naively</p>



<a name="168516250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516250">(Jun 19 2019 at 15:18)</a>:</h4>
<p>yeah, you could imagine having some special hir node that means "return type of the enclosing function" or something but...</p>



<a name="168516255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516255">(Jun 19 2019 at 15:18)</a>:</h4>
<p>Mhm, because you need the output type to appear in two places</p>



<a name="168516266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516266">(Jun 19 2019 at 15:19)</a>:</h4>
<p>... at that point it's not <em>necessarily</em> easier than the more principled way</p>



<a name="168516276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516276">(Jun 19 2019 at 15:19)</a>:</h4>
<p>Indeed</p>



<a name="168516307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516307">(Jun 19 2019 at 15:19)</a>:</h4>
<p>Especially given that it's not actually the return type, but the output type of the return type</p>



<a name="168516314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516314">(Jun 19 2019 at 15:19)</a>:</h4>
<p>right</p>



<a name="168516364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516364">(Jun 19 2019 at 15:20)</a>:</h4>
<p>I have to say that I'm not entirely convinced that HIR-level desugaring is correct for async fn</p>



<a name="168516410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516410">(Jun 19 2019 at 15:20)</a>:</h4>
<p>not that I thikn we should rewrite that</p>



<a name="168516448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516448">(Jun 19 2019 at 15:20)</a>:</h4>
<p>(In general, I feel like some of the things we do at HIR level might be better done at HIR -&gt; MIR, though it'd require more duplication in the type-checker)</p>



<a name="168516451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516451">(Jun 19 2019 at 15:20)</a>:</h4>
<p><em>anyway</em> that's off topic</p>



<a name="168516483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516483">(Jun 19 2019 at 15:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> do you have a "concise" listing of the pending obligations?</p>



<a name="168516488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516488">(Jun 19 2019 at 15:21)</a>:</h4>
<p>I couldn't quite extract it from the log you posted</p>



<a name="168516493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516493">(Jun 19 2019 at 15:21)</a>:</h4>
<p>I guess I can try to get one</p>



<a name="168516631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516631">(Jun 19 2019 at 15:23)</a>:</h4>
<div class="codehilite"><pre><span></span>pending_obligations=[
Obligation(predicate=Binder(TraitPredicate(&lt;_#0t as std::marker::Sized&gt;)), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:19: 4:22, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: SizedReturnType }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=Binder(TraitPredicate(&lt;_#0t as std::future::Future&gt;)), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:19: 4:22, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: SizedReturnType }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [_#0t], item_def_id: DefId(2:7110 ~ core[54d4]::future[0]::future[0]::Future[0]::Output[0]) }, i32)), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:19: 4:22, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: SizedReturnType }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=Binder(TraitPredicate(&lt;_#1t as std::marker::Sized&gt;)), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:23: 10:2, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: ItemObligation(DefId(1:5180 ~ std[d43b]::future[0]::from_generator[0])) }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=Binder(TraitPredicate(&lt;_#1t as std::ops::Generator&gt;)), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:23: 10:2, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: ItemObligation(DefId(1:5180 ~ std[d43b]::future[0]::from_generator[0])) }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [_#1t], item_def_id: DefId(2:1651 ~ core[54d4]::ops[0]::generator[0]::Generator[0]::Yield[0]) }, ())), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:23: 10:2, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: ItemObligation(DefId(1:5180 ~ std[d43b]::future[0]::from_generator[0])) }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0),
Obligation(predicate=WellFormed(_#1t), cause=ObligationCause { span: src/test/ui/async-await/issue-54326.rs:4:23: 10:2, body_id: HirId { owner: DefIndex(12), local_id: 25 }, code: MiscObligation }, param_env=ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, depth=0)
]
</pre></div>



<a name="168516709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516709">(Jun 19 2019 at 15:24)</a>:</h4>
<p>ok let me see if I can make sense of that :)</p>



<a name="168516763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516763">(Jun 19 2019 at 15:25)</a>:</h4>
<p>Only those with a <code>_#1t</code> are considered because <code>self_type_matches_expected_vid</code> filters out the others.</p>



<a name="168516794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516794">(Jun 19 2019 at 15:25)</a>:</h4>
<p>looks like</p>



<a name="168516799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516799">(Jun 19 2019 at 15:25)</a>:</h4>
<div class="codehilite"><pre><span></span>?0: Sized
?0: Future
&lt;?0 as Future&gt;::Output = i32
?1: Sized
?1: Generator
&lt;?1 as Generator&gt;::Yield = ()
?1: WF
</pre></div>



<a name="168516812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516812">(Jun 19 2019 at 15:25)</a>:</h4>
<p>here <code>?0</code> is the (hidden) return type</p>



<a name="168516815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516815">(Jun 19 2019 at 15:26)</a>:</h4>
<p>and <code>?1</code> is the type of the argument</p>



<a name="168516861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516861">(Jun 19 2019 at 15:26)</a>:</h4>
<p>crucially, the link between <code>?0</code> and <code>?1</code> is absent -- which isn't too surprising to me</p>



<a name="168516869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516869">(Jun 19 2019 at 15:26)</a>:</h4>
<p>well, maybe a little</p>



<a name="168516880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516880">(Jun 19 2019 at 15:26)</a>:</h4>
<p>(here's the raw log that is a snippet from: <a href="https://gist.githubusercontent.com/davidtwco/2fa0aa796dc313bc7c90579b729b83ed/raw/4ca70a22274c61475e486354f583ec70bb5db257/gistfile1.txt" target="_blank" title="https://gist.githubusercontent.com/davidtwco/2fa0aa796dc313bc7c90579b729b83ed/raw/4ca70a22274c61475e486354f583ec70bb5db257/gistfile1.txt">https://gist.githubusercontent.com/davidtwco/2fa0aa796dc313bc7c90579b729b83ed/raw/4ca70a22274c61475e486354f583ec70bb5db257/gistfile1.txt</a>)</p>



<a name="168516892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516892">(Jun 19 2019 at 15:26)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">from_generator</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Generator</span><span class="o">&lt;</span><span class="n">Yield</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Future</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span>::<span class="n">Return</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</pre></div>



<a name="168516922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516922">(Jun 19 2019 at 15:27)</a>:</h4>
<p>so clearly the input type is <code>T</code></p>



<a name="168516938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516938">(Jun 19 2019 at 15:27)</a>:</h4>
<p>I guess that the return type (from our perspective) is an "opaque type", so an <code>impl Future&lt;Output = T::Return&gt;</code></p>



<a name="168516951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168516951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168516951">(Jun 19 2019 at 15:28)</a>:</h4>
<p>and that return type has to be unified with <code>?0</code></p>



<a name="168517007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517007">(Jun 19 2019 at 15:28)</a>:</h4>
<p>and then we have to try to solve <code>&lt;?0 as Future&gt;::Output = i32</code></p>



<a name="168517025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517025">(Jun 19 2019 at 15:28)</a>:</h4>
<p>which will create a <em>new</em> obligation that <code>&lt;?1 as Generator&gt;::Return = i32</code> eventually</p>



<a name="168517036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517036">(Jun 19 2019 at 15:29)</a>:</h4>
<p>so yeah it's pretty indirect to figure this out :) several steps down the line</p>



<a name="168517049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517049">(Jun 19 2019 at 15:29)</a>:</h4>
<p>and I'm understanding <span class="user-mention" data-user-id="119009">@eddyb</span>'s comments better, because in particular the processing of the return type probably happens at the wrong time right now.</p>



<a name="168517063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517063">(Jun 19 2019 at 15:29)</a>:</h4>
<p>(does this all make sense so far?)</p>



<a name="168517146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517146">(Jun 19 2019 at 15:30)</a>:</h4>
<p>we <em>do</em> have some logic that does some creative stuff where we unify the return type (here, <code>impl Future</code>) with the expected type (here, <code>?0</code>) to try and figure out what it might mean for the arguments</p>



<a name="168517171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517171">(Jun 19 2019 at 15:30)</a>:</h4>
<p>I'm not super familiar with unification (or how the solving of an obligation happens, but I can leave that as a black box for now).</p>



<a name="168517202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517202">(Jun 19 2019 at 15:31)</a>:</h4>
<p>this is the </p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="sd">/// Unifies the output type with the expected type early, for more coercions</span>
<span class="w">    </span><span class="sd">/// and forward type information on the input expressions.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">expected_inputs_for_expected_output</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">                                           </span><span class="n">call_span</span>: <span class="nc">Span</span><span class="p">,</span><span class="w"></span>
<span class="w">                                           </span><span class="n">expected_ret</span>: <span class="nc">Expectation</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">                                           </span><span class="n">formal_ret</span>: <span class="nc">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">                                           </span><span class="n">formal_args</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="n">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">])</span><span class="w"></span>
<span class="w">                                           </span>-&gt; <span class="nb">Vec</span><span class="o">&lt;</span><span class="n">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</pre></div>


<p>function</p>



<a name="168517245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517245">(Jun 19 2019 at 15:31)</a>:</h4>
<p>the important thing is that this is speculative and preserves the shape but disconnects the resulting type variables from the original</p>



<a name="168517247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517247">(Jun 19 2019 at 15:31)</a>:</h4>
<blockquote>
<p>I'm not super familiar with unification</p>
</blockquote>
<p>ok. For our purposes, you can imagine that a <code>?T</code> variable is like a little mutable cell in one of two states:</p>
<ul>
<li>unbound (initially)</li>
<li>bound to a type <code>U</code></li>
</ul>



<a name="168517292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517292">(Jun 19 2019 at 15:32)</a>:</h4>
<p>once it gets bound, any reference to <code>?T</code> is kind of "redirected" to <code>U</code></p>



<a name="168517294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517294">(Jun 19 2019 at 15:32)</a>:</h4>
<p>because we can't <em>enforce</em> the expected type, we can only be guided by it</p>



<a name="168517304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517304">(Jun 19 2019 at 15:32)</a>:</h4>
<p>(until we know the actual type and can try coercing it)</p>



<a name="168517325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517325">(Jun 19 2019 at 15:32)</a>:</h4>
<p>hmm, we are already processing obligations in that code</p>



<a name="168517341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517341">(Jun 19 2019 at 15:33)</a>:</h4>
<p>oh, but only a subset</p>



<a name="168517362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517362">(Jun 19 2019 at 15:33)</a>:</h4>
<p>we should add some debug logging in there, <span class="user-mention" data-user-id="116107">@davidtwco</span>, that might help point a bit</p>



<a name="168517371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517371">(Jun 19 2019 at 15:33)</a>:</h4>
<p>Sorry, where?</p>



<a name="168517390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517390">(Jun 19 2019 at 15:33)</a>:</h4>
<p>the <code>expected_inputs_for_expected_output</code> function</p>



<a name="168517393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517393">(Jun 19 2019 at 15:33)</a>:</h4>
<p>I'm adding some in my local branch</p>



<a name="168517450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517450">(Jun 19 2019 at 15:34)</a>:</h4>
<p>in the meantime, that'd be a good function for us to talk through to help understand better what's going on</p>



<a name="168517466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168517466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168517466">(Jun 19 2019 at 15:34)</a>:</h4>
<p>though maybe it'll have to be tomorrow -- should we shoot for 8am UTC-07:00 tomorrow again? I should probably get up and go wherever it is I am supposed to be</p>



<a name="168603416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168603416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168603416">(Jun 20 2019 at 15:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="116107">@davidtwco</span> around?</p>



<a name="168605241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168605241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168605241">(Jun 20 2019 at 15:20)</a>:</h4>
<p>I’m around now sorry.</p>



<a name="168605253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168605253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168605253">(Jun 20 2019 at 15:21)</a>:</h4>
<p>Had a small fire at work.</p>



<a name="168605272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168605272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168605272">(Jun 20 2019 at 15:21)</a>:</h4>
<p>(digital fire, not real)</p>



<a name="168956092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168956092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168956092">(Jun 25 2019 at 17:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> so I did some more digging into this, sorry for not writing back later -- my <em>impression</em> was that we <em>may</em> just need a somewhat smal PR here.</p>



<a name="168956141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168956141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168956141">(Jun 25 2019 at 17:02)</a>:</h4>
<p>That's good.</p>



<a name="168956146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168956146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168956146">(Jun 25 2019 at 17:02)</a>:</h4>
<p>I was actually just looking for an issue to work on.</p>



<a name="168956152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168956152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168956152">(Jun 25 2019 at 17:02)</a>:</h4>
<p>though one that makes me ever so mildly nervous (it has implications around the chalk strategy, I think)</p>



<a name="168958351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168958351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168958351">(Jun 25 2019 at 17:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> to briefly update you on whatI had planned to do</p>



<a name="168959247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959247">(Jun 25 2019 at 17:37)</a>:</h4>
<p>in the <a href="https://github.com/rust-lang/rust/blob/40ab9d2bd57a2203131abd723f7120e960299fae/src/librustc_typeck/check/mod.rs#L3248-L3255" target="_blank" title="https://github.com/rust-lang/rust/blob/40ab9d2bd57a2203131abd723f7120e960299fae/src/librustc_typeck/check/mod.rs#L3248-L3255"><code>expected_inputs_for_expected_output</code></a> function...</p>



<a name="168959292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959292">(Jun 25 2019 at 17:37)</a>:</h4>
<p>...we <a href="https://github.com/rust-lang/rust/blob/40ab9d2bd57a2203131abd723f7120e960299fae/src/librustc_typeck/check/mod.rs#L3278-L3282" target="_blank" title="https://github.com/rust-lang/rust/blob/40ab9d2bd57a2203131abd723f7120e960299fae/src/librustc_typeck/check/mod.rs#L3278-L3282">create a temporary fulfillment context and try to fulfill various trait obligations</a>...</p>



<a name="168959312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959312">(Jun 25 2019 at 17:37)</a>:</h4>
<p>...but we are only fulfilling obligations that resulted from the subtyping rules</p>



<a name="168959326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959326">(Jun 25 2019 at 17:37)</a>:</h4>
<p>and not obliations that we already know to be required</p>



<a name="168959380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959380">(Jun 25 2019 at 17:38)</a>:</h4>
<p>I was going to -- at least experimentally, to start -- add a line like</p>



<a name="168959447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959447">(Jun 25 2019 at 17:38)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">for</span><span class="w"> </span><span class="n">obligation</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">fulfill_cx</span><span class="p">.</span><span class="n">borrow</span><span class="p">().</span><span class="n">pending_obligations</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">fulfill</span><span class="p">.</span><span class="n">register_predicate_obligation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">obligation</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="168959453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959453">(Jun 25 2019 at 17:39)</a>:</h4>
<p>and see what happens :)</p>



<a name="168959457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959457">(Jun 25 2019 at 17:39)</a>:</h4>
<p>care to give it a try?</p>



<a name="168959950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168959950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168959950">(Jun 25 2019 at 17:44)</a>:</h4>
<p>Can do.</p>



<a name="168968171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168968171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168968171">(Jun 25 2019 at 19:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Fails to compile <code>proc_macro</code> with that change:</p>
<div class="codehilite"><pre><span></span>error[E0631]: type mismatch in closure arguments
   --&gt; src/libproc_macro/bridge/client.rs:298:29
    |
298 |               panic::set_hook(Box::new(move |info| {
    |                               ^        ----------- found signature of `fn(&amp;std::panic::PanicInfo&lt;&#39;_&gt;) -&gt; _`
    |  _____________________________|
    | |
299 | |                 let hide = BridgeState::with(|state| match state {
300 | |                     BridgeState::NotConnected =&gt; false,
301 | |                     BridgeState::Connected(_) | BridgeState::InUse =&gt; true,
...   |
305 | |                 }
306 | |             }));
    | |______________^ expected signature of `for&lt;&#39;r, &#39;s&gt; fn(&amp;&#39;r std::panic::PanicInfo&lt;&#39;s&gt;) -&gt; _`
    |
    = note: required for the cast to the object type `dyn for&lt;&#39;r, &#39;s&gt; std::ops::Fn(&amp;&#39;r std::panic::PanicInfo&lt;&#39;s&gt;) + std::marker::Send + std::marker::Sync`

error[E0271]: type mismatch resolving `for&lt;&#39;r, &#39;s&gt; &lt;[closure@src/libproc_macro/bridge/client.rs:298:38: 306:14 prev:_] as std::ops::FnOnce&lt;(&amp;&#39;r std::panic::PanicInfo&lt;&#39;s&gt;,)&gt;&gt;::Output == ()`
   --&gt; src/libproc_macro/bridge/client.rs:298:29
    |
298 |               panic::set_hook(Box::new(move |info| {
    |  _____________________________^
299 | |                 let hide = BridgeState::with(|state| match state {
300 | |                     BridgeState::NotConnected =&gt; false,
301 | |                     BridgeState::Connected(_) | BridgeState::InUse =&gt; true,
...   |
305 | |                 }
306 | |             }));
    | |______________^ expected bound lifetime parameter, found concrete lifetime
    |
    = note: required for the cast to the object type `dyn for&lt;&#39;r, &#39;s&gt; std::ops::Fn(&amp;&#39;r std::panic::PanicInfo&lt;&#39;s&gt;) + std::marker::Send + std::marker::Sync`

error: aborting due to 2 previous errors
</pre></div>



<a name="168970931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168970931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168970931">(Jun 25 2019 at 19:50)</a>:</h4>
<p>d'oh :)</p>



<a name="168970965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168970965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168970965">(Jun 25 2019 at 19:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> what is branch name?</p>



<a name="168970997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168970997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168970997">(Jun 25 2019 at 19:51)</a>:</h4>
<p>I’ve not pushed it.</p>



<a name="168971012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168971012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168971012">(Jun 25 2019 at 19:51)</a>:</h4>
<p>Unless you don’t mean Git branch?</p>



<a name="168971124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168971124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168971124">(Jun 25 2019 at 19:52)</a>:</h4>
<p>It was just pasting those three lines below the three you linked previously.</p>



<a name="168971146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/168971146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#168971146">(Jun 25 2019 at 19:53)</a>:</h4>
<p>I did mean git branch but yeah I could make the change independently</p>



<a name="169901943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/169901943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#169901943">(Jul 08 2019 at 20:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> circling back to this, I guess i'll create a branch locally</p>



<a name="169902648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/mismatched%20types%20diag%20%2354326/near/169902648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/mismatched.20types.20diag.20.2354326.html#169902648">(Jul 08 2019 at 20:36)</a>:</h4>
<p>Cool, I’ve not looked at this since we last spoke.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>